<?php
	/**************************/
	/**** Fonctions ORDER *****/
	/**************************/
	function insertOrder($id_user,$adressD,$adressR,$cpD,$cpR,$cityD,$cityR,$countryD,$countryR){
		$sql = 'INSERT INTO `order` (id_user,adressDelivery,postcodeDelivery,cityDelivery,countryDelivery,adressBilling,postcodeBilling,cityBilling,countryBilling) 
		VALUES ('.$id_user.', "'.$adressD.'",'.$cpD.', "'.$cityD.'", "'.$countryD.'", "'.$adressR.'",'.$cpR.', "'.$cityR.'", "'.$countryR.'" )';
		$result = mysql_query($sql);
	}

	function getLastIdOrderByUser($id_user){
		$sql = 'SELECT id_order FROM `order`
		WHERE id_user = '.$id_user.'
		ORDER BY date_order DESC
		LIMIT 1';
		return fetch($sql);
	}

	function getLastOrderByUser($id_user){
		$sql = 'SELECT * FROM `order`
		WHERE id_user = '.$id_user.'
		ORDER BY date_order DESC
		LIMIT 1';
		return fetch($sql);
	}
?>